# -*- encoding: utf-8 -*-
"""
File Name: workflow
Description:
Author: 'lirui'
date: 2025/6/27
Contact: marjey_lee@163.com
Change Activity:
Date: 2025/6/27:
"""
from modules.zabbix_utils.utils.zabbix_client_manager import ZabbixManager
from projects.generation.create_zabbix_device_snmp_monitor.config.config import ZABBIX_LOGIN_INFO

_clients_mapping = {}


def get_zabbix_clients_mapping(ip, port):
    key = f'{ip}_{port}'
    if key not in _clients_mapping:
        login_info = ZABBIX_LOGIN_INFO[ip]
        client = ZabbixManager(
            ip=ip,
            port=int(port),
            username=login_info['username'],
            password=login_info['password'],
            new_url=True
        )
        _clients_mapping[key] = client
    return _clients_mapping[key]
